const merchantsDao = require("../dao/merchantsDao");

exports.getList = async (req, res) => {
  const merchants = await merchantsDao.getAll();
  res.json(merchants);
};

exports.getRegions = async (req, res) => {
  const regions = await merchantsDao.getRegions();
  res.json({ regions });
};

exports.approve = async (req, res) => {
  const { id } = req.params;
  const merchant = await merchantsDao.approve(id);
  res.json({ code: 200, message: "审核通过", merchant });
};

exports.reject = async (req, res) => {
  const { id } = req.params;
  const { remark } = req.body;
  const merchant = await merchantsDao.reject(id, remark);
  res.json({ code: 200, message: "审核拒绝", merchant });
};